<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <title>货品管理</title>
   <script src="http://localhost/yhd/Static/Js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="http://localhost/yhd/Static/hdjs/hdjs.css"/>
    <script src="http://localhost/yhd/Static/hdjs/hdjs.min.js" type="text/javascript" charset="utf-8"></script>
    <style type="text/css">
        .plus_minus{
            width: 20px;
        }
        table .hd-btn{
            margin: 0;
        }
        table tr a:hover{
            text-decoration: none;        
        }
        /*标题*/
  .title{background:#6FB100;height:30px;color:#fff;line-height:30px;font-weight:bold;padding-left:10px;font-size:14px;}
   .title .add{float:right;}
.title .add a{color:#fff;line-height:23px;margin-right:18px;}
.title a:hover{text-decoration: none;} 
    </style>
    <link rel="stylesheet" type="text/css" href="http://localhost/yhd/Static/bootstrap/css/bootstrap.min.css"/>

</head>
<body>
<div class="title"  >货品列表
 

</div>
<div class="wrap">
    <form action="<?php echo U('add');?>" method='post'>
		<table class='hd-table hd-table-list'>
			<tr>
				<th>货品ID</th>
				<?php foreach ($spec as $k=>$v){?>
					<th><?php echo $v['attr_name'];?></th>
				<?php }?>
				<th>库存</th>
				<th>货号</th>
				<th>操作</th>
			</tr>
			<?php foreach ($data as $k=>$v){?>
			<tr>
				<td><?php echo $v['gtid'];?></td>
				<?php foreach ($v['spec'] as $kk=>$vv){?>
					<td><?php echo $vv;?></td>
				<?php }?>
				<td><?php echo $v['inventory'];?></td>
				<td><?php echo $v['number'];?></td>
				<td>
				<a href="<?php echo U('edit',array('gtid'=>$v['gtid'],'gid'=>$v['gid']));?>" class="btn btn-warning"><i class="icon-pencil icon-white"></i>修改</a>
				<a href="javascript:hd_modal_del(<?php echo $v['gtid'];?>);" class="btn btn-danger"><i class="icon-trash icon-white"></i>删除</a>
				</td>
			</tr>
			<?php }?>
			<tr>
				<td>添加</td>
				<?php foreach ($spec as $k=>$v){?>
				<td>
				  <input type="hidden" value="<?php echo $v['attr_name'];?>" name="attr_name[]" />   
					<select name="spec[]" class="w200">
						<option value="">请选择</option>
						<?php foreach ($v['option'] as $kk=>$vv){?>
						<option value="<?php echo $vv['goods_att_id'];?>"><?php echo $vv['attr_value'];?></option>
						<?php }?>
					</select>
				</td>
				<?php }?>
				<td>
					<input type="text" name="inventory" class="w200" id="" />
				</td>
				<td>
					<input type="text" name="number" class="w200" id="" />
				</td>
				<td>
					<input type="hidden" value="<?php echo $hd['get']['goods_id'];?>" name="gid" />
                <input type="hidden" value="<?php echo $hd['get']['type_id'];?>"name="type_id" />
		<input type="submit" value='保存添加' class="btn btn-warning" style="height: 34px;"/>
				</td>
			</tr>
		</table>
		
	</form>
    <div class="page_hdjob">
     
    </div>
</div>
<script type="text/javascript">
    function hd_modal_del(id) {
        hd_modal({
            width: 320,//宽度
            height: 150,//高度
            title: '是否删除？',//标题
            content: '',//提示信息
            button: true,//显示按钮
            button_success: "确定",//确定按钮文字
            button_cancel: "取消",//关闭按钮文字
            timeout: 0,//自动关闭时间 0：不自动关闭
            shade: true,//背景遮罩
            shadeOpacity: 0.4,//背景透明度
            success: function () {//点击确定后的事件
                location.href = 'http://localhost/yhd/index.php/Admin/Shoplist'+'&a=del&gtid='+id;
            },
            cancel: function () {//点击关闭后的事件
                
            }
        });
    }
</script>
</body>
</html>


